package com.xunker.appointment.controller;
import com.xunker.appointment.result.Result;
import com.xunker.appointment.service.ScheduleService;
import com.xunker.appointment.vo.hospital.DoctorVo;

import com.xunker.appointment.vo.order.ScheduleOrderVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Api(tags = "排班接口")
@RestController
@RequestMapping("admin/hospital/schedule")
//@CrossOrigin
public class ScheduleController {
    @Autowired
    private ScheduleService scheduleService;
    //查询所属科室医生
    @GetMapping("getDoctor/{hospitalCode}/{departmentCode}")
    public Result getDoctor(@PathVariable String hospitalCode,@PathVariable String departmentCode){
        Set<DoctorVo> doctor=scheduleService.getDoctorByHD(hospitalCode,departmentCode);
        return Result.ok(doctor);
    }
    //查询所属科室医生排班信息
    @GetMapping("getSchedule/{hospitalCode}/{departmentCode}/{doctorName}")
    public Result getSchedule(@PathVariable String hospitalCode,@PathVariable String departmentCode,@PathVariable String doctorName){
        Map<String,Object> schedule=scheduleService.getScheduleByHDN(hospitalCode,departmentCode,doctorName);
        return Result.ok(schedule);
    }
    @GetMapping("getScheduleOrderVo/{scheduleId}")
    public ScheduleOrderVo getScheduleOrderVo(@PathVariable("scheduleId") Long scheduleId){
        ScheduleOrderVo scheduleOrderVo=scheduleService.getScheduleOrderVo(scheduleId);
        return scheduleOrderVo;
    }
}
